﻿using System.Windows.Forms;
using UI.ProductManagement;

namespace UI.StorageManagement
{
    public partial class FrmSto6a00 : UI.ParentForm.BaseMain
    {
        FrmSto6a00Edit edit = null;
        ToolStripButton tspBatchEdit = null;

        public FrmSto6a00(string modulecode, string action)
            : base(modulecode, action)
        {
            InitializeComponent();

            this.tspView.Visible = false;
            this.tspEdit.Text = "调 整";

            tspBatchEdit = new ToolStripButton();
            tspBatchEdit.Tag = "M";
            tspBatchEdit.Text = "批量调整";
            tspBatchEdit.Click += tspBatchEdit_Click;
            tspTop.Items.Add(tspBatchEdit);
        }

        void tspBatchEdit_Click(object sender, System.EventArgs e)
        {
            var medit = new FrmSto6a00Medit(this.ModuleCode, "M", GetTitleStyle(this.Text, "批量调整"), "");
            medit.ShowDialog();
            if (medit.IsReload) base.BindGrid();
        }

        protected override void UpdatePager(UI.Common.Pager pager)
        {
            pager.FilterAppName = "c.muser";
        }

        protected override void OnEditClick(ToolStripButton btn, DataGridViewRow row)
        {
            OpenEdit("M", btn.Text, Components.Validation.ToString(row.Cells["listid"].Value));
        }

        private void OpenEdit(string action, string btnText, string code)
        {
            edit = new FrmSto6a00Edit(action, GetTitleStyle(this.Text, btnText), code);
            edit.ShowDialog();
            if (edit.IsReload) base.BindGrid();
        }
    }
}
